<template>
    <div class="sxpse">
        <div v-for="(item,index) in pseData" :key="item" >
            <div class="node">
                <div class="line" :class="item.status>2?'line-yes':''" v-if="pseData.length-1!==index"></div>
                <div class="Head" v-if="item.level===index">
                     <div v-if="item.status===8" class="siocn"></div>
                     <div v-else-if="item.status===0" class="siocn4"></div>
                    <div v-else-if="item.status===1" class="siocn1"></div>
                    <div v-else-if="item.status===9" class="siocn2"></div>
                    <div v-else-if="item.status===7" class="siocn3"></div>
                </div>
                <div style="flex:1; margin: 10px">
                    <div style="width: 100%; display: flex;justify-content: space-between;">
                        <div class="nodeName">{{item.nodeName}}</div>
                        <div class="datetime">{{item.datetime}}</div>
                    </div>
                  <div v-if="item.nodeName!=='流程结束'">
                    <div v-if="index===0 &&item.status===8 ">{{'由 '+item.dealUser+' 发起'}}</div>
                    <div v-else-if="item.status===8">{{'由 '+item.dealUser+' 同意'}}</div>
                    <div v-else-if="item.status<3">{{'待 '+funct.arrToStr2(item.userinfo)+' 处理'}}</div>
                    <div v-else-if="item.status===9">{{'由 '+item.dealUser+' 拒绝'}}</div>
                    <div v-else-if="item.status===7">{{'由 '+item.dealUser+' 退回'}}</div>
                    <div v-if="item.opinion" class="opinion">{{item.opinion}}</div>
                  </div>

                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import {reactive,watch,ref,onBeforeMount,toRef,computed} from 'vue'
    import funct from '/@/utils/preload.js'
    import XEUtils from 'xe-utils'
    export default {
        name:'sxpse',
        props:['data','ish5'],
        setup(props,ctx){
            let pseData =ref(props.ish5?props.data:[])
            watch(() => props.data,()=>{
                pseData.value = XEUtils.orderBy(props.data, 'level')
            })
            return{
                funct,
                pseData
            }
        }
    }
</script>

<style scoped>
.sxpse{
    height: 100%;
    overflow: auto;
    background-color: rgb(255, 255, 255);
}
.nodeName{
    font-size: 16px;
}
.node{
    width: 100%;
    display: flex;
    align-items: center;
    position: relative;
}
.datetime{
    color: rgb(125, 125, 125);
}
.opinion{
    width: 100%;
    background-color:  #e9e9eb;
    padding: 3px 3px 3px 10px;
    border-radius: 2px;
    color:  #555555;
    margin-top: 8px;
}
.Head{
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #fff;
    position: relative;
    z-index:2;
}
.siocn{
    position: relative;
    background-color: #fff;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: url(../../../assets/dui.png) center center no-repeat;
    background-size: 30px 30px;
}
.siocn1{
    position: relative;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 50px;
    background: url(../../../assets/san.png) center center no-repeat;
    background-size: 30px 30px;
}
.siocn2{
    position: relative;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 50px;
    background: url(../../../assets/cafill.png) center center no-repeat;
    background-size: 30px 30px;
}
.siocn3{
    position: relative;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 30px;
    background: url(../../../assets/chexiao.png) center center no-repeat;
    background-size: 30px 30px;
}
.siocn4{
    position: relative;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 50px;
    background: url(../../../assets/to-do.png) center center no-repeat;
    background-size: 30px 30px;
}
.line{
    position: absolute;
    left: 15px;
    top: 30px;
    width: 2px;
    height: 100%;
    z-index:1;
    background-color: rgba(0, 0, 0, 0.462);
}
.line-yes{
    background-color: rgb(26, 104, 250);
}
.m-r10{
    margin-right: 10px;
}
.hui{
    color: rgba(57, 57, 57, 0.685);
}
.name{
    font-size: 12px;
    color: rgb(69, 69, 69);
}
.ov-5{
    opacity: .7;
}
</style>